package ils.web.action;

import ils.services.CatalogService;

import java.util.Map;

import org.apache.struts2.interceptor.SessionAware;

import com.opensymphony.xwork2.ActionSupport;

public class AddCategoryAction extends ActionSupport implements SessionAware
{
    private Map<String, Object> session;
    private CatalogService catalogService;
    private String categoryName;
    
    public String execute() throws Exception
    {
        if(categoryName == null) return INPUT;
        else
        {
            catalogService.createCategory(categoryName, null);
            return SUCCESS;
        }
    }
    
    @Override
    public void setSession(Map<String, Object> arg0)
    {
        this.session = arg0;
    }

    public void setCatalogService(CatalogService catalogService)
    {
        this.catalogService = catalogService;
    }

    public String getCategoryName()
    {
        return categoryName;
    }

    public void setCategoryName(String categoryName)
    {
        this.categoryName = categoryName;
    }

}
